<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*, com.zjr.domain.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="<%=path %>/skin/css/base_style.css" />
<link type="text/css" rel="stylesheet" href="<%=path %>/skin/css/table.css" />
<script type="text/javascript" src="<%=path %>/skin/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="<%=path %>/skin/js/table.js"></script>
<%
	ArrayList<User> users = (ArrayList<User>)request.getAttribute("users");
%>
</head>
<body>
	<table class="tab">
		<tr>
	        <th width="5%" class="tab_th fyh"><img src="<%=path %>/skin/images/lcp_checkbox5.png" /></th>
	        <th width="10%" class="tab_th fyh">ID</th>
	        <th width="10%" class="tab_th fyh">用户名</th>
	        <th width="10%" class="tab_th fyh">密码</th>
	        <th width="10%" class="tab_th fyh">部门</th>
	        <th width="10%" class="tab_th fyh">电话</th>
	        <th width="10%" class="tab_th fyh">地址</th>
	        <th width="10%" class="tab_th fyh">职位</th>
	        <th width="25%" class="tab_th fyh">操作</th>
    	</tr>
    	<%
    		for(int i = 0; i < users.size(); i++){
    			User user = users.get(i);
    			String department = "";
    			String position = "";
    			String flag = "";
    			if(user.getUid() == 1){
    				flag = "hidden";
    			}else{
    				flag = "button";
    			}
    			switch(user.getDid()){
	    			case 1: department = "技术部";break;
	    			case 2: department = "研发部";break;
	    			case 3: department = "人事部";break;
	    			case 4: department = "财务部";break;
	    			case 5: department = "行政部";break;
    			}
    			switch(user.getRole()){
	    			case 0: position = "普通员工";break;
	    			case 1: position = "部长";break;
	    			case 2: position = "总经理";break;
	    			case 3: position = "管理员";break;
    			}
    			%>
    			<tr>
    				<td class="tab_td1 fyh"><img src="<%=path %>/skin/images/lcp_checkbox5.png" /></td>
    				<td class="tab_td1 fyh"><%=user.getUid() %></td>
    				<td class="tab_td1 fyh"><%=user.getUsername() %></td>
    				<td class="tab_td1 fyh"><%=user.getPassword() %></td>
    				<td class="tab_td1 fyh"><%=department %></td>
    				<td class="tab_td1 fyh"><%=user.getPhone() %></td>
    				<td class="tab_td1 fyh"><%=user.getAddress() %></td>
    				<td class="tab_td1 fyh"><%=position %></td>
    				<td class="tab_td1 fyh">
        				<input type="<%=flag %>" onclick="window.location.href='UserServlet?flag=delete&id=<%=user.getUid() %>'" value="" class="tab_button1"/>
        				<input type="<%=flag %>" onclick="window.location.href='UserServlet?flag=find&id=<%=user.getUid() %>'" value="" class="tab_button2" />
       				</td>
    			</tr>
    			<%
    		}
    	%>
	</table>
	<div class="table_page">
	    <input type="button" class="page_button1"/>
	    <input type="button" class="page_button2"/>
	    <label class="page_number">1</label>
	    <label class="page_number">2</label>
	    <input type="button" class="page_button3"/>
	    <input type="button" class="page_button4"/>
	</div>
</body>
</html>